package com.example.consul.controller;

import lombok.AllArgsConstructor;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author donniexue
 */
@RestController
@RequestMapping("/consul")
@AllArgsConstructor
public class ConsulController {

    private final Environment environment;

    @GetMapping("/change")
    public String changeLoop() {
        String port = environment.getProperty("server.port");
        return "this is " + port;
    }

}
